package com.sloera.spring.beans.annotation.repository;

import com.sloera.spring.beans.annotation.TestObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @author sloera
 * @create 2020/4/6
 */
//去除value时，如果有两个实现类， autowired会报错，或者注入的时候使用qualifier
//@Repository(value = "userRepository")
@Repository
public class UserRepositoryImpl implements UserRepository {
    //未装配也可以启动
    @Autowired(required = false)
    private TestObject testObject;

    @Override
    public void save() {
        System.out.println("UserRepositoryImpl save ...");
        System.out.println(testObject);
    }
}
